//
//  combatLossViewController.m
//  Project
//
//  Created by iD Student on 7/31/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "combatLossViewController.h"

@interface combatLossViewController ()

@end

@implementation combatLossViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    NSUserDefaults * woodW1 = [NSUserDefaults standardUserDefaults];
    [woodW1 setInteger: woodW forKey: @"woodW"];
    [woodW1 synchronize];
    NSUserDefaults * woodS1 = [NSUserDefaults standardUserDefaults];
    [woodS1 setInteger: woodS forKey: @"woodS"];
    [woodS1 synchronize];
    NSUserDefaults * woodI1 = [NSUserDefaults standardUserDefaults];
    [woodI1 setInteger: woodI forKey: @"woodI"];
    [woodI1 synchronize];
    NSUserDefaults * stoneW1 = [NSUserDefaults standardUserDefaults];
    [stoneW1 setInteger: stoneW forKey: @"stoneW"];
    [stoneW1 synchronize];
    NSUserDefaults * stoneS1 = [NSUserDefaults standardUserDefaults];
    [stoneS1 setInteger: stoneS forKey: @"stoneS"];
    [stoneS1 synchronize];
    NSUserDefaults * stoneI1 = [NSUserDefaults standardUserDefaults];
    [stoneI1 setInteger: stoneI forKey: @"stoneI"];
    [stoneI1 synchronize];
    NSUserDefaults * ironW1 = [NSUserDefaults standardUserDefaults];
    [ironW1 setInteger: ironW forKey: @"ironW"];
    [ironW1 synchronize];
    NSUserDefaults * ironS1 = [NSUserDefaults standardUserDefaults];
    [ironS1 setInteger: ironS forKey: @"ironS"];
    [ironS1 synchronize];
    NSUserDefaults * ironI1 = [NSUserDefaults standardUserDefaults];
    [ironI1 setInteger: ironI forKey: @"ironI"];
    [ironI1 synchronize];
    NSUserDefaults * woodLvl1 = [NSUserDefaults standardUserDefaults];
    [woodLvl1 setInteger: woodLvl forKey: @"woodLvl"];
    [woodLvl1 synchronize];
    NSUserDefaults * stoneLvl1 = [NSUserDefaults standardUserDefaults];
    [stoneLvl1 setInteger: stoneLvl forKey: @"stoneLvl"];
    [stoneLvl1 synchronize];
    NSUserDefaults * ironLvl1 = [NSUserDefaults standardUserDefaults];
    [ironLvl1 setInteger: ironLvl forKey: @"ironLvl"];
    [ironLvl1 synchronize];
    NSUserDefaults * w1 = [NSUserDefaults standardUserDefaults];
    [w1 setInteger: w forKey: @"w"];
    [w1 synchronize];
    NSUserDefaults * s1 = [NSUserDefaults standardUserDefaults];
    [s1 setInteger: s forKey: @"s"];
    [s1 synchronize];
    NSUserDefaults * i1 = [NSUserDefaults standardUserDefaults];
    [i1 setInteger: i forKey: @"i"];
    [i1 synchronize];
    NSUserDefaults * x1 = [NSUserDefaults standardUserDefaults];
    [x1 setInteger: x forKey: @"x"];
    [x1 synchronize];
    NSUserDefaults * z1 = [NSUserDefaults standardUserDefaults];
    [z1 setInteger: z forKey: @"z"];
    [z1 synchronize];
    NSUserDefaults * victor1 = [NSUserDefaults standardUserDefaults];
    [victor1 setInteger: victor forKey: @"victor"];
    [victor1 synchronize];    
    NSUserDefaults * wood1 = [NSUserDefaults standardUserDefaults];
    [wood1 setInteger: wood forKey: @"wood"];
    [wood1 synchronize]; 
    NSUserDefaults * stone1 = [NSUserDefaults standardUserDefaults];
    [stone1 setInteger: stone forKey: @"stone"];
    [stone1 synchronize]; 
    NSUserDefaults * iron1 = [NSUserDefaults standardUserDefaults];
    [iron1 setInteger: iron forKey: @"iron"];
    [iron1 synchronize]; 
    NSUserDefaults * day1 = [NSUserDefaults standardUserDefaults];
    [day1 setInteger: day forKey: @"day"];
    [day1 synchronize]; 
    NSUserDefaults * fastGathering1 = [NSUserDefaults standardUserDefaults];
    [fastGathering1 setInteger: fastGathering forKey: @"fastGathering"];
    [fastGathering1 synchronize]; 
    NSUserDefaults * cheapTroops1 = [NSUserDefaults standardUserDefaults];
    [cheapTroops1 setInteger: cheapTroops forKey: @"cheapTroops"];
    [cheapTroops1 synchronize]; 
    NSUserDefaults * raiding1 = [NSUserDefaults standardUserDefaults];
    [raiding1 setInteger: raiding forKey: @"raiding"];
    [raiding1 synchronize]; 
    NSUserDefaults * valiantSoldiers1 = [NSUserDefaults standardUserDefaults];
    [valiantSoldiers1 setInteger: valiantSoldiers forKey: @"valiantSoldiers"];
    [valiantSoldiers1 synchronize];
    NSUserDefaults * cityBarricade1 = [NSUserDefaults standardUserDefaults];
    [cityBarricade1 setInteger: cityBarricade forKey: @"cityBarricade"];
    [cityBarricade1 synchronize]; 
    NSUserDefaults * willBeAttacked1 = [NSUserDefaults standardUserDefaults];
    [willBeAttacked1 setInteger: willBeAttacked forKey: @"willBeAttacked"];
    [willBeAttacked1 synchronize];  
    NSUserDefaults * fighterAmt1 = [NSUserDefaults standardUserDefaults];
    [fighterAmt1 setInteger: fighterAmt forKey: @"fighterAmt"];
    [fighterAmt1 synchronize]; 
    NSUserDefaults * archerAmt1 = [NSUserDefaults standardUserDefaults];
    [archerAmt1 setInteger: archerAmt forKey: @"archerAmt"];
    [archerAmt1 synchronize]; 
    NSUserDefaults * cavalryAmt1 = [NSUserDefaults standardUserDefaults];
    [cavalryAmt1 setInteger: cavalryAmt forKey: @"cavalryAmt"];
    [cavalryAmt1 synchronize]; 
    NSUserDefaults * catapultAmt1 = [NSUserDefaults standardUserDefaults];
    [catapultAmt1 setInteger: catapultAmt forKey: @"catapultAmt"];
    [catapultAmt1 synchronize];
    NSUserDefaults * isNewGame1 = [NSUserDefaults standardUserDefaults];
    [isNewGame1 setInteger: isNewGame forKey: @"isNewGame"];
    [isNewGame1 synchronize];
    [super viewDidLoad];
	// Do any additional setup after loading the view.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (IBAction)lost:(id)sender 
{    
    if (isNewGame == TRUE)
    {
        [self.presentingViewController.presentingViewController.presentingViewController.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES];
    }
    else 
    {
        [self.presentingViewController.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES];
    }
}
@end
